import { Roles } from "src/decorators/roles.decorators"
import { Logs } from "src/logs/logs.entity"
import { Menus } from "src/menus/entities/menu.entity"
import { User } from "src/user/entities/user.entity"

const caslAction = (path:string) => {
    const map = {
        '/user': User,
        '/logs': Logs,
        '/roles': Roles,
        '/menu': Menus,
        '/auth': 'Auth', // auth模块不需要鉴权
    }
    for (let i = 0; i < Object.keys(map).length; i++) {
        const key = Object.keys(map)[i];
        if (path.startsWith(key)) {
          return map[key];
        }
    }
}
export default caslAction